home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / rom.xli < prev    next >
Internet Message Format  |  1991-04-12  |  6KB

  1. From comp.sys.handhelds Wed Jan 30 07:42:16 1991
  2. Path: mentor.cc.purdue.edu!purdue!news.cs.indiana.edu!julius.cs.uiuc.edu!usc!cs.utexas.edu!helios!tamuts!n233dk
  3. From: n233dk@tamuts.tamu.edu (Rick Grevelle)
  4. Newsgroups: comp.sys.handhelds
  5. Subject: ROM XLIB's (Hidden ROM)
  6. Message-ID: <11612@helios.TAMU.EDU>
  7. Date: 30 Jan 91 10:08:20 GMT
  8. Sender: news@helios.TAMU.EDU
  9. Organization: Texas A&M University
  10. Lines: 193
  11.  
  12.  
  13. For those individuals who are currently interested in the 48's internals,
  14. the following information should be somewhat helpful as far as the use of
  15. XLIB's in system RPL is concerned.  XLIB's are frequently found within an
  16. RPL instruction stream.  An unthreaded command such as STO, reveals that a
  17. system RPL call made to another RPL routine, which contains an XLIB object
  18. in its instruction stream, can seemingly lead to a dead end.  This is, for
  19. the most part, due to the fact it has been impossible to determine where
  20. the system RPL is that's executed when the XLIB is evaulated.
  21.  
  22. Now it should be understood that it is ROM based XLIB's I'm referring to
  23. in the above, but the following details can be applied to library XLIB's
  24. as well.  The whereabouts of the RPL routine, which is executed when any
  25. of the libraries' XLIB's are evaluated, can be easily determined simply by
  26. reading the link table within that library.  Since this has already been
  27. explained by several individuals, and is not crucial to an understanding 
  28. of the material about to be disclosed, a rediscussion will be avoided.
  29.  
  30. As previously mentioned, the system RPL which constitutes the STO command,
  31. and begins at #20CCDh, when unthreaded reveals several system RPL routines
  32. which contain XLIB objects embedded in their instruction streams.  A good
  33. example of this can be found in the RPL routine responsible for storing a
  34. backup or a library object in level two, to the port specified by the real
  35. number in level one.  Located at #215BFh, this RPL routine utilizes what is
  36. in fact "XLIB 240 95", and when evaluated, executes the system RPL which is
  37. responsible for the actual storing of the stack arguments just described.
  38.  
  39. But where in ROM is the system RPL located that is executed when the XLIB
  40. is evaluated?  Well in my version E, it's at #7F7BDh, and is the ROM that's
  41. normally covered by RAM.  This is why some system RPL has to utilize XLIB's
  42. to call to other system RPL routines; because RPL can't call to any of the
  43. entry points in "hidden" ROM by simply placing the address of the desired
  44. routine in the RPL instruction stream.  Accessing entry points in "hidden"
  45. ROM requires bank switching, and it's XLIB's which possess this ability.
  46. HP uses XLIB's in their system RPL to access the various entry points in
  47. the "hidden" ROM.  
  48.  
  49. The following programs utilize several prefixed machine routines which will
  50. aid in the manipulation of these previously illusive ROM base XLIB's.  Only
  51. one of the four routines included here do I consider to be slightly kludged.
  52. And although short, all four provide powerful new tools for manipulating all
  53. XLIB's.  For the sake of time a SYSEVAL type listing of the routines is used
  54. as explanation.
  55.  
  56.  
  57. \->XLIB take two real numbers as arguments and returns the appropriate XLIB.
  58.  
  59.         Arguments            Results
  60.     4:                4:
  61.     3:                3:
  62.     2:        240        2:
  63.     1:         95        1:    XLIB 240 95
  64.  
  65.  
  66. \->XL    begin rpl
  67.  
  68. 02D9D    begin RPL
  69. 18A8D    need 2 arguments
  70. 18FB2    check arguments
  71. 04099    system binary <11h>
  72. 02D9D    begin RPL
  73. 18CEA    real\->system binary
  74. 03223    swap
  75. 18CEA    real\->system binary
  76. 03223    swap
  77. 07E50    \->xlib
  78. 0312B    end rpl
  79. 0312B    end rpl
  80.  
  81.  
  82.  
  83. \->XLIB
  84.  
  85. %%HP: T(3)A(D)F(.);
  86. "D9D20D8A812BF8199040D9D20AEC8132230AEC813223005E70B2130B213097F3"
  87.  
  88.  
  89.  
  90. XLIB\-> requires an XLIB argument, and is is the reversal of the above.
  91.  
  92.  
  93.         Arguments            Results
  94.     4:                4:
  95.     3:                3:
  96.     2:                2:        240
  97.     1:    XLIB 240 95        1:         95
  98.  
  99.  
  100. XLIB\->
  101.  
  102. 02D9D    begin rpl
  103. 18AB2    need 1 argument
  104. 18FB2    check argument
  105. 04085    system binary <Fh>
  106. 02D9D    begin rpl
  107. 08CCC    xlib\->
  108. 18DBF    system binary\->real
  109. 03223    swap
  110. 18DBF    system binary\->real
  111. 03223    swap
  112. 0312B    end rpl
  113. 0312B    end rpl
  114.  
  115.  
  116. XLIB\->
  117.  
  118. %%HP: T(1)A(D)F(.);
  119. "D9D202BA812BF8158040D9D20CCC80FBD8132230FBD8132230B2130B21306983"
  120.  
  121.  
  122. Although the previous two routines are quite useful, they are trivial by
  123. comparison to the next.  X\->R is an XLIB-to-RPL conversion scheme where
  124. upon an XLIB argument is taken, and the RPL routine that would normally be
  125. executed when the XLIB is evaluated is returned.  So if it were system RPL
  126. that resides in the "hidden" ROM, the level one result would contain the
  127. unevaluated routine to which the XLIB calls.  There is no longer any need
  128. for guessing, simply use HEX\-> on the stack object to examine it.  Or use
  129. PRG\-> to unthread, and then HEX\-> to aquire the individuals addresses for
  130. the externals.  The applications here are quite obvioulsy mulitple.
  131.  
  132.  
  133.         Arguments             Results
  134.     4:                1:  External External
  135.     3:                    <2h> External
  136.     2:                    External External
  137.     1:                    External External
  138.  
  139.  
  140. X\->R
  141.  
  142. 02D9D    begin rpl
  143. 18AB2    need 1 argument
  144. 18FB2    check argument
  145. 04085    system binary <Fh>
  146. 02D9D    begin rpl
  147. 07E99    xlib\->rpl
  148. 61A3B    return if true
  149. 05016    errn #004
  150. 0312B    end rpl
  151. 0312B    end rpl
  152.  
  153.  
  154. X\->R
  155.  
  156. %%HP: T(1)A(D)F(.);
  157. "D9D202BA812BF8158040D9D2099E70B3A1661050B2130B2130470B"
  158.  
  159.  
  160. Lastly, is the above routine's reverse scheme, as this is exactly how it
  161. functions.  It takes the above result as an argument and returns as its
  162. result the argument with which we started.
  163.  
  164.  
  165.  
  166.         Arguments            Results
  167.     1:  External External        4:
  168.         <2h> External        3:
  169.         External External        2:
  170.         External External        1:      XLIB 240 95
  171.  
  172.  
  173. R\->X
  174.  
  175. 02D9D    begin rpl
  176. 18AB2    need 1 argument
  177. 18FB2    check argument
  178. 0403F    system binary <8h>
  179. 02D9D    begin rpl
  180. 07E76    rpl\->xlib
  181. 07E99    xlib\->rpl
  182. 0712A   jump next call/object if true
  183. 11056    errn #12D
  184. 07E76    rpl\->xlib
  185. 0312B    end rpl
  186. 0312B    end rpl
  187.  
  188.  
  189. R\->X
  190.  
  191. %%HP: T(1)A(D)F(.);
  192. "D9D202BA812BF81F3040D9D2067E7099E70A21706501167E70B2130B2130D796"
  193.  
  194.  
  195. Some final notes; all of this was entered rather hastyly by me, and by
  196. hand.  While I did take the time to double check the \->ASC encoded
  197. strings, there still could be errors.  In which case corrections will
  198. be made as quickly as possible.  The information which appears here in
  199. regards to the four prefixed machine routines #07E50h, #08CCCh, #07E99h,
  200. and #07E76h, is the result of my own experimentation, and in no way came
  201. from HP.  I would also recommend disassembling #07E99h for further study
  202. to those interested in how the 48 accesses the covered ROM.  Good luck.
  203.  
  204. Rick Grevelle
  205.  
  206.